<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑用户</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/resource/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/resource/css/mylay.css">
</head>
<body>
    <div style="padding: 20px; background-color: #F2F2F2;">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card">
                    <div class="layui-card-body">
                        <form class="layui-form" action="">
                            <table class="layui-table" lay-even lay-skin="nob">
                                <thead></thead>
                                <tbody>
                                    <tr>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">上级ID</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="" value="{$userInfo.sid}" autocomplete="off" placeholder="" class="layui-input" readonly>
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">该ID为上级ID</div>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">用户昵称</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="nickname" value="{$userInfo.nickname}" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">用户昵称</div>
                                            </div>
                                        </td>
                                        <!-- <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">返点级别</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="rebate" value="{$userInfo.rebate}" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">当前返点级别</div>
                                            </div>
                                        </td> -->
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">用户账号</label>
                                                <div class="layui-input-inline">
                                                    <input type="text"  value="{$userInfo.username}" autocomplete="off" placeholder="" class="layui-input" readonly>
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">只读模式</div>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">会员等级</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="vip_level" value="{$userInfo['vip_level']}" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">1,2,3,4,5</div>
                                                <!-- <div class="layui-form-mid layui-word-aux">当前状态(不能修改，跟vip会员有关联,需要改名会员)</div> -->
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">类型</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="mem_type" value="{$userInfo['mem_type']}" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">0:会员;1:发行方</div>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">会员类型</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="user_type" value="{$userInfo['user_type']}" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">1:会员;2:商家;3:皇冠商家</div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">会员类型</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="agent_type" value="{$userInfo['agent_type']}" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">0:会员;1:代理</div>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">账号类型</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="account_type" value="{$userInfo['account_type']}" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">1:真人，2:机器人</div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">登录密码</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="password" value="" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">登录操作时验证的密码，不修改留空</div>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">取款密码</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="fund_password" value="" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">取款等操作时验证的密码，不修改留空</div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">头像</label>
                                                <div class="layui-input-inline">
                                                    <div class="layui-upload">

                                                        <div class="layui-upload-list">
                                                            <img class="layui-upload-img" id="header_image" style="width:150px;" src="{$userInfo['header']}">
                                                            <p id="header_image_text"></p>
                                                        </div>
                                                        <button type="button" class="layui-btn" id="header">
                                                            <i class="layui-icon">&#xe67c;</i>上传
                                                        </button>
                                                    </div>
                                                    <input type="hidden" name="header" id="header_input" value="{$userInfo['header']}" placeholder="" autocomplete="off" class="layui-input" readonly>
                                                </div>

                                            </div>
                                        </td>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">背景简介图</label>
                                                <div class="layui-input-inline">
                                                    <div class="layui-upload">

                                                        <div class="layui-upload-list">
                                                            <img class="layui-upload-img" id="photo_wall_image" style="width:150px;" src="{$userInfo['photo_wall']}">
                                                            <p id="photo_wall_image_text"></p>
                                                        </div>
                                                        <button type="button" class="layui-btn" id="photo_wall">
                                                            <i class="layui-icon">&#xe67c;</i>上传
                                                        </button>
                                                    </div>
                                                    <input type="hidden" name="photo_wall" id="photo_wall_input" value="{$userInfo['photo_wall']}" placeholder="" autocomplete="off" class="layui-input" readonly>
                                                </div>

                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">信用分</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="credit" value="{$userInfo.credit}" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux"></div>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">安全邮箱</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="" value="{$userInfo.mail}" autocomplete="off" placeholder="" class="layui-input">
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">请不要随意填写，否则导致账户不安全</div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">交易状态</label>
                                                <div class="layui-input-inline">
                                                    <select name="trade_state" lay-verify="required" lay-search="">
                                                        <option value="1" {if $userInfo['trade_state'] eq 1} selected{/if}>正常</option>
                                                        <option value="2" {if $userInfo['trade_state'] eq 2} selected{/if}>冻结</option>
                                                    </select>
                                                </div>
                                                <div class="layui-form-mid layui-word-aux"></div>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">当前状态</label>
                                                <div class="layui-input-inline">
                                                    <select name="state" lay-verify="required" lay-search="">
                                                        {foreach $userState as $key=>$value }
                                                        {if $key}
                                                        <option value="{$key}"{if $userInfo['state'] eq $key} selected{/if}>{$value}</option>
                                                        {/if}
                                                        {/foreach}
                                                    </select>
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">当前状态</div>
                                            </div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">注册时间</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="" value="{$userInfo.reg_time|date='Y-m-d H:i:s'}" autocomplete="off" placeholder="" class="layui-input" readonly>
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">只供查看，不能修改</div>
                                            </div>
                                        </td>
                                        <td>
                                            <div class="layui-form-item">
                                                <label class="layui-form-label">登录时间</label>
                                                <div class="layui-input-inline">
                                                    <input type="text" name="last_login" value="{if $userInfo.last_login}{$userInfo.last_login|date='Y-m-d H:i:s'}{/if}" autocomplete="off" placeholder="" class="layui-input" readonly>
                                                </div>
                                                <div class="layui-form-mid layui-word-aux">只供查看，不能修改</div>
                                            </div>
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                            <div class="layui-form-item" style="margin-top: 40px;text-align: center;">
                                <input type="hidden" name="id" value="{$userInfo.id}" autocomplete="off" class="layui-input">
                                <div class="layui-input-block">
                                    <button class="layui-btn" lay-submit lay-filter="useredit">立即提交</button>
                                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>

<script src="/resource/layuiadmin/layui/layui.js"></script>
<script src="/resource/js/manage/init_date.js"></script>
<!--<script src="/resource/js/manage/user.js"></script>-->
<script>
    layui.use(['table'], function() {
        var $ = layui.$
            ,form = layui.form
            , table = layui.table;

        form.on('submit(useredit)', function(data){
            $.ajax({
                url: "/manage/user/edit",
                data: data.field,
                type: "POST",
                dataType: "json",
                timeout: 15000,
                beforeSend: function(){
                    layer.load(1);
                },
                success: function(msg){
                    var alertStr = (msg == 1) ? '操作成功' : msg;
                    layer.msg(alertStr, {time: 2000}, function(){
                        if(msg==1){
                            parent.layer.closeAll();
                            parent.layui.table.reload('userList');
                        }
                    });
                },
                complete: function(){
                    layer.closeAll("loading");
                }
            });
            return false;
        });
    })
</script>
</body>
</html>
